.class Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent$2;
.super Ljava/lang/Object;
.source "AddAssetEvent.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;->saveAsset(Landroid/content/Context;Ljava/lang/String;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;

.field final synthetic val$url:Ljava/lang/String;


# direct methods
.method constructor <init>(Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;Ljava/lang/String;)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 115
    iput-object p1, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent$2;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;

    iput-object p2, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent$2;->val$url:Ljava/lang/String;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 14

    .prologue
    const/4 v13, 0x0

    .line 120
    :try_start_0
    iget-object v7, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent$2;->val$url:Ljava/lang/String;

    invoke-static {v7}, Lcom/burstly/lib/util/Utils;->makeGetRequest(Ljava/lang/String;)Lorg/apache/http/HttpResponse;

    move-result-object v5

    .line 121
    .local v5, response:Lorg/apache/http/HttpResponse;
    invoke-interface {v5}, Lorg/apache/http/HttpResponse;->getStatusLine()Lorg/apache/http/StatusLine;

    move-result-object v7

    invoke-interface {v7}, Lorg/apache/http/StatusLine;->getStatusCode()I

    move-result v6

    .line 122
    .local v6, statusCode:I
    invoke-interface {v5}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v2

    .line 123
    .local v2, entity:Lorg/apache/http/HttpEntity;
    invoke-interface {v2}, Lorg/apache/http/HttpEntity;->getContentLength()J

    move-result-wide v0

    .line 124
    .local v0, contentLength:J
    const/16 v7, 0xc8

    if-ne v6, v7, :cond_0

    const-wide/16 v7, 0x0

    cmp-long v7, v0, v7

    if-nez v7, :cond_1

    .line 125
    :cond_0
    sget-object v7, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v8, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;->TAG:Ljava/lang/String;

    const-string v9, "Error downloading media url {0}\nResponse code {1}\nContent length {2}"

    const/4 v10, 0x3

    new-array v10, v10, [Ljava/lang/Object;

    const/4 v11, 0x0

    iget-object v12, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent$2;->val$url:Ljava/lang/String;

    aput-object v12, v10, v11

    const/4 v11, 0x1

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v12

    aput-object v12, v10, v11

    const/4 v11, 0x2

    invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v12

    aput-object v12, v10, v11

    invoke-virtual {v7, v8, v9, v10}, Lcom/burstly/lib/util/LoggerExt;->logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 127
    iget-object v7, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent$2;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;

    new-instance v8, Ljava/lang/StringBuilder;

    invoke-direct {v8}, Ljava/lang/StringBuilder;-><init>()V

    const-string v9, "Error downloading media url "

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    iget-object v9, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent$2;->val$url:Ljava/lang/String;

    invoke-virtual {v8, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v8

    invoke-virtual {v8}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;->fireError(Ljava/lang/String;)V

    .line 137
    .end local v0           #contentLength:J
    .end local v2           #entity:Lorg/apache/http/HttpEntity;
    .end local v5           #response:Lorg/apache/http/HttpResponse;
    .end local v6           #statusCode:I
    :goto_0
    return-void

    .line 129
    .restart local v0       #contentLength:J
    .restart local v2       #entity:Lorg/apache/http/HttpEntity;
    .restart local v5       #response:Lorg/apache/http/HttpResponse;
    .restart local v6       #statusCode:I
    :cond_1
    iget-object v7, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent$2;->val$url:Ljava/lang/String;

    invoke-static {v7, v5}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;->getFileName(Ljava/lang/String;Lorg/apache/http/HttpResponse;)Ljava/lang/String;

    move-result-object v4

    .line 130
    .local v4, fileName:Ljava/lang/String;
    iget-object v7, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent$2;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;

    invoke-virtual {v7, v2, v4}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;->tryToStore(Lorg/apache/http/HttpEntity;Ljava/lang/String;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 133
    .end local v0           #contentLength:J
    .end local v2           #entity:Lorg/apache/http/HttpEntity;
    .end local v4           #fileName:Ljava/lang/String;
    .end local v5           #response:Lorg/apache/http/HttpResponse;
    .end local v6           #statusCode:I
    :catch_0
    move-exception v3

    .line 134
    .local v3, exception:Ljava/lang/Exception;
    sget-object v7, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v8, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;->TAG:Ljava/lang/String;

    invoke-virtual {v3}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v9

    new-array v10, v13, [Ljava/lang/Object;

    invoke-virtual {v7, v8, v9, v10}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 135
    iget-object v7, p0, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent$2;->this$0:Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;

    invoke-virtual {v3}, Ljava/lang/Exception;->getMessage()Ljava/lang/String;

    move-result-object v8

    invoke-virtual {v7, v8}, Lcom/burstly/lib/component/networkcomponent/burstly/html/mraid/AddAssetEvent;->fireError(Ljava/lang/String;)V

    goto :goto_0
.end method
